﻿using System;
using System.Collections;
using System.Data;

public partial class CauHoi : System.Web.UI.UserControl
{
    Data data = new Data();
    protected void Page_Load(object sender, EventArgs e)
    {
        FillCauHoiPhapLuat();
    }

    private void FillCauHoiPhapLuat()
    {
        DataTable tableMucPL = data.GetTable_By_Name("MucLucPhapLuat");
        for (int i = 0; i < 18; i++)
        {
            string noidung = "";
            DataTable tableCauHoiTheoMuc = data.GetTable_By_Name_And_Top_Where("HoiDap", 5, "where MucPhapLuatID=" + tableMucPL.Rows[i]["MucPhapLuatID"].ToString());
            for (int j = 0; j < tableCauHoiTheoMuc.Rows.Count; j++)
            {
                if (tableCauHoiTheoMuc.Rows[j]["HoiDapNoiDungCauHoi"].ToString().Length > 200)
                {
                    noidung += "<li style='font-size:13px;'><b>Hỏi : </b><p style='font-size:16px;'>" + tableCauHoiTheoMuc.Rows[j]["HoiDapNoiDungCauHoi"].ToString().Substring(0, 200) + "... <a href='Hoi-Dap-Phap-Luat/Default.aspx?HoiDapID=" + tableCauHoiTheoMuc.Rows[j]["HoiDapID"].ToString() + "' style='color:Brown;font-style:italic;font-size:16px;font-weight:bold' >Xem Thêm</a></p></li>";
                }
                else
                {
                    noidung += "<li style='font-size:13px;'><b>Hỏi : </b><p style='font-size:16px'>" + tableCauHoiTheoMuc.Rows[j]["HoiDapNoiDungCauHoi"].ToString() + "... <a href='Hoi-Dap-Phap-Luat/Default.aspx?HoiDapID=" + tableCauHoiTheoMuc.Rows[j]["HoiDapID"].ToString() + "' style='color:Brown;font-style:italic;font-size:16px;font-weight:bold' >Xem Thêm</a></p></li>";
                }
            }
            ltlCauHoi.Text += "<DIV class=gk_tab_item-style1 style='HEIGHT: 500px'>" +
                              "<DIV class=gk_tab_item_space>" + noidung + "</DIV></DIV>";
            noidung = "";
        }
    }
}
